package com.jastar.android.game.cannon.utils;

import android.content.Context;
import android.media.AudioAttributes;
import android.media.SoundPool;
import com.jastar.android.test.R;

public class SoundManager {
    private SoundPool soundPool;
    private int fireSoundId;
    private int hitSoundId;

    public SoundManager(Context context) {
        AudioAttributes audioAttributes = new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_GAME).setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build();
        soundPool = new SoundPool.Builder().setMaxStreams(3).setAudioAttributes(audioAttributes).build();
        fireSoundId = soundPool.load(context, R.raw.fire, 1);
        hitSoundId = soundPool.load(context, R.raw.rock, 1);
    }

    public void playFireSound() {
        soundPool.play(fireSoundId, 1, 1, 0, 0, 1);
    }

    public void playHitSound() {
        soundPool.play(hitSoundId, 1, 1, 0, 0, 1);
    }

}